package com.hzh.page.controller.admin;

import com.hzh.page.common.utils.R;
import com.hzh.page.pojo.RegionEntity;
import com.hzh.page.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author 胡泽华
 */
@RestController
@Api(tags = "地区")
@RequestMapping("/page/admin/region")
public class RegionController {
    @Autowired
    private RegionService regionService;

    @ApiOperation("地区列表")
    @GetMapping("/regionList")
    public R regionList(HttpServletRequest request) {
        String token = request.getHeader("token");

        List<RegionEntity> list = regionService.list();
        return R.ok().put("regionList", list);
    }
}
